function request(url, method, data, showLoading = true) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: ' http://123.207.219.13:3003' + url,
      method: method,
      data: data,
      success(res) {
        if (showLoading) {
          wx.hideLoading()
        }
        resolve(res.data)
      },
      fail(err) {
        if (showLoading) {
          wx.hideLoading()
        }
        reject(err)
      },
    })
  })
}

module.exports = {
  request: request
}